package com.aleaho.cftrack.db;

import android.content.Context;

import com.aleaho.cftrack.db.gen.LastLoginDao;
import com.aleaho.cftrack.db.gen.UserDao;

import org.greenrobot.greendao.database.Database;

/**
 * DBHelper继承DaoMaster.OpenHelper,
 * 在类的构造函数传入Context context,数据库的名称 name
 * 重写onUpgrade方法,升级数据库就不丢失原来的数据.
 *
 *
 * Created by Administrator on 2017/10/2.
 */

public class DBHelper extends com.aleaho.cftrack.db.gen.DaoMaster.OpenHelper {


    public DBHelper(Context context, String name) {
        super(context, name,null);
    }

    @Override
    public void onUpgrade(Database db, int oldVersion, int newVersion) {
        super.onUpgrade(db, oldVersion, newVersion);

        UserDao.createTable(db,true);
        LastLoginDao.createTable(db,true);



    }
}
